
<?php
    require_once 'functions.php';
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>所有用户</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
   <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
   <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
        table
 
 {

     border-collapse: collapse;

     margin: 0 auto;

     text-align: center;

 }
table  th{
border: 1px solid #cad9ea;
background:red;
height: 30px;
background: rgb(188, 206, 156);
}

 table td, table 

 {

     border: 1px solid #cad9ea;

     color: #666;

     height: 30px;

 }

 table thead 

 {

     background-color: #CCE8EB;

     width: 100px;

 }

 table tr:nth-child(odd)

 {

     background: #fff;

 }

 table tr:nth-child(even)

 {

     background: #F5FAFA;

 }
 /* table td tr:hover{
    background:red;
 } */
            </style> 
        
    
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12" style="text-align:center">
<h1><a href="adduser.html">添加用户</a></h1>
</div>
</div>

<table>
<div class="row" sty>
    <tr>
    <th  class="col-xs-1" style="text-align: center;">id</th>
    <th  class="col-xs-2" style="text-align: center;">用户名</th>
    <th class="col-xs-1" style="text-align: center;">密码</th>
    <th class="col-xs-1" style="text-align: center;">性别</th>
    <th class="col-xs-1" style="text-align: center;">QQ</th>
    <th class="col-xs-1" style="text-align: center;">电话</th>
    <th class="col-xs-2" style="text-align: center;">地址</th>
    <th class="col-xs-1" style="text-align: center;">email</th>
    <th class="col-xs-2" style="text-align: center;">修改/删除</th></tr>
    </div></div>
<?php
//连接数据库
connnetDb();
//查询数据表中的所有数据,并按照id降序排列
$result=mysql_query("SELECT * FROM usertext ORDER BY id ");
//获取数据表的数据条数
$dataCount=mysql_num_rows($result);
//echo $dataCount;
//打印输出所有数据
 
 
for($i=0;$i<$dataCount;$i++){
    $result_arr=mysql_fetch_assoc($result);
    $id=$result_arr['id'];
    $name=$result_arr['username'];
    $password=$result_arr['password'];
    $sex=$result_arr['sex'];
    $qq=$result_arr['qq'];
    $phone=$result_arr['phone'];
    $address=$result_arr['address'];
    $email=$result_arr['email'];
    //print_r($result_arr);
    echo 
    
"<div class='row'>
<div class='col-xs-12 col-sm-12 col-md-12'>
<tr>
<td>$id</td><td>$name</td><td>$password</td>
<td>$sex</td><td>$qq</td><td>$phone</td><td>$address</td><td>$email</td><td><a href='edituser.php?id=$id'>修改</a> <a href='deleteuser.php?id=$id'>删除</a></td></tr>
</div>
</div>
";
}
?>
</table>
</body>
</div>
</html>
